/*
 * Copyright 2017-2101 Innel.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.hykj.xxltest.service;

import com.hykj.xxltest.base.BaseService;
import com.hykj.xxltest.mapper.UserPointHistoryMapper;
import com.hykj.xxltest.model.UserModel;
import com.hykj.xxltest.model.UserPointHistoryModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * 用户积分变化记录
 *
 * @author innel
 * @email 2638086622@qq.com
 * @date 2018-04-07 10:33:01
 */
@Service
public class UserPointHistoryService extends BaseService<UserPointHistoryModel, UserPointHistoryMapper> {


    @Autowired
    UserService userService;

    @Override
    protected UserPointHistoryModel change(UserPointHistoryModel model, Map condition) {
        UserModel userModel=userService.getById(model.getUserId());

        if(userModel!=null){
            model.setUserName(userModel.getNickname());
        }


        return super.change(model, condition);
    }
}